package com.zhuang.collection.list;

import java.util.ArrayList;
import java.util.Iterator;

public class ListFor {
	public static void main(String[] args) {
		ArrayList<String> list = new ArrayList<>();
		list.add("三国演义");
		list.add("红楼梦");
		list.add("水浒传");
		list.add("西游记");

		System.out.println("===迭代器===");
		Iterator<String> iterator = list.iterator();
		while (iterator.hasNext()) {
			System.out.println(iterator.next());
		}

		System.out.println("===增强for===");
		for (String o : list) {
			System.out.println(o);
		}
		System.out.println("===普通for循环===");
		for (int i = 0; i < list.size(); i++) {
			System.out.println(list.get(i));
		}
	}
}
